package cqrtplm.controller.thirdPartyAPI;

import com.hustcad.plm.pdm.enumeration.model.vo.EnumerationItemHandleVO;
import com.hustcad.plm.pdm.enumeration.service.TyplmEnumerationItemService;
import com.ty.basic.entity.IdentifierEntity;
import com.ty.basic.response.ResponseResult;
import cqrtplm.constant.RouteConstant;
import cqrtplm.dto.thirdPartyAPI.RestAdapterMomDTO;
import cqrtplm.dto.thirdPartyAPI.RestAdapterMomOrderDTO;
import cqrtplm.mapper.RtCfgSerialNumberMapper;
import cqrtplm.service.MomApiService;
import cqrtplm.vo.MomApiResponseVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.math.BigInteger;
import java.util.List;

/**
 * @description: 所有下拉值接口
 * @author: zhengxiong.jiang
 * @createDate: 2025-10-23
 * @version: 1.0
 */
@RestController
@RequestMapping(RouteConstant.DOWN + "v1")
public class DownValueApiController {

    @Resource
    private TyplmEnumerationItemService typlmEnumerationItemService;

    @Resource
    private RtCfgSerialNumberMapper rtCfgSerialNumberMapper;


    /**
     * 所有枚举下拉的值
     * @param name 内部名称
     * @return
     */
    @GetMapping("/getDownList")
    public ResponseResult<List<EnumerationItemHandleVO>> restInvoke(@RequestParam String name) {
        //根据内部名称获取oid
        String oid = rtCfgSerialNumberMapper.selectDefoidByName(name);
        IdentifierEntity identifierEntity = new IdentifierEntity();
        identifierEntity.setOid(new BigInteger(oid));
        return ResponseResult.success(this.typlmEnumerationItemService.queryEnumerationItemByDefOid(identifierEntity));
    }



}
